package com.shuai.orderfood.merchants.controller;

import com.shuai.orderfood.common.HttpStatusCodeEnum;
import com.shuai.orderfood.common.Result;
import com.shuai.orderfood.exceptions.OrderFoodException;
import com.shuai.orderfood.merchants.dto.SystemSettingsDto;
import com.shuai.orderfood.merchants.service.SystemSettingsService;
import jakarta.annotation.Resource;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;

@RestController
@CrossOrigin
@RequestMapping("/systemSettings")
public class SystemSettingsController {

    @Resource
    private SystemSettingsService systemSettingsService;

    //添加WiFi
    @PostMapping("/add")
    public Result addSystemSettings(@RequestBody SystemSettingsDto systemSettingsDto) throws Exception {
        boolean success = systemSettingsService.saveSystemSetting(systemSettingsDto);
        if(success) {
            return Result.success();
        }else {
            throw new OrderFoodException(HttpStatusCodeEnum.SYSTEMSETTINGSPARAMISNULL.getCode(),HttpStatusCodeEnum.SYSTEMSETTINGSPARAMISNULL.getMessage());
        }
    }

    //删除WiFi
    @DeleteMapping("/remove")
    public Result removeSystemSettings() {
        return null;
    }

    //修改WiFi
    @PutMapping("/modify")
    public Result modifySystemSettings() {
        return null;
    }

    //查看WiFi
    @GetMapping("/get")
    public Result getSystemSettings() {
        return null;
    }
}
